package org.dromara.sms4j;

import org.dromara.sms4j.core.factory.SmsFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.event.ApplicationContextEvent;
import org.springframework.context.event.EventListener;
import sms4j.dao.MySmsDao;
import sms4j.local.LocalFactory;

@Configuration
@Import(MySmsDao.class)
public class Load {
    @Autowired
    MyConfig config;

    @EventListener
    public void init(ApplicationContextEvent event) {

        // 创建SmsBlend 短信实例
        SmsFactory.createSmsBlend(config);
        SmsFactory.createSmsBlend(config, "hw");
    }


    @Bean
    public LocalFactory localFactory() {
        return LocalFactory.instance();
    }


}
